<%
	String username = request.getParameter("username");
	if (request.getParameter("username") == null) {
		request.setAttribute("login", Boolean.FALSE);
	} else {
		request.setAttribute("login", Boolean.TRUE);
	}

	String error = null;%>
<%@ include file="header.jsp" %>
<%
	if (user != null) {
		try {
			response.sendRedirect("index.jsp");
		} catch(IllegalStateException exc) {
			%><script language="JavaScript">window.location = 'index.jsp';</script><%
		}
	} else if (request.getParameter("username") != null) {
		error = "Incorrect username and/or password";
	}
%>
<% if (error != null) { %>
	<b style="color: red;" id="loginError"><%= error %></b><br/><br/>
<% } %>
<form method="post" action="login.jsp">
<table cellpadding="10" cellspacing="0" class="table">
	<tr>
		<td align="center" bgcolor="<%= CSSDefaults.BG_COLOR %>" colspan="2" id="Login"><span style="color: white; font-size: 14pt; font-weight: bold;">Login</span></td>
	</tr>
	<tr id="UsernameRow">
		<td align="right"><b>Username:</b></td>
		<td><input type="text" id="username" name="username"/></td>
	</tr>
	<tr id="PasswordRow">
		<td align="right"><b>Password:</b></td>
		<td><input type="password" id="password" name="password"/></td>
	</tr>
	<tr>
		<td align="center" colspan="2"><input type="submit" value="Login"/></td>
	</tr>
</table>
</form>
<script type="text/javascript">
	document.getElementById('username').focus();
</script>
<%@ include file="footer.jsp" %>